package net.sf.cldsql.dj.container;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import net.sf.cldsql.dj.container.base.DiAop;
import net.sf.cldsql.dj.mvc.DiService;
import net.sf.cldsql.dj.utl.Codelet;

/**
 * BeanEntry
 */
public class DiDef {

    private Class intf;
    private Class impl;
    private Class[] paramTypes;
    private Object[] params;
    private Codelet initCode;
    private short mode;
    private String name;
    private Class<DiAop<DiService>> aop;
    private String pattern;

    /**
     * @return name
     */
    public String getName() {
        return name;
    }
    
    /**
     * @return intf
     */
    public Class getIntf() {
        return intf;
    }

    /**
     * @return impl
     */
    public Class getImpl() {
        return impl;
    }
    
    /**
     * @return paramTypes
     */
    public Class[] getParamTypes() {
        return paramTypes;
    }

    /**
     * @return params
     */
    public Object[] getParams() {
        return params;
    }

    /**
     * @return mode
     */
    public short getMode() {
        return mode;
    }

    /** @return aop */
    public Class<DiAop<DiService>> getAop() {
        return aop;
    }

    /**
     * @return initCode
     */
    public Codelet getInitCode() {
        return initCode;
    }

    /**
     * @param intf
     * @param initCode
     * @param mode
     * @param aop 
     */
    public DiDef(String name, Class intf, Class impl, Class[] paramTypes, Object[] params, short mode, Class<DiAop<DiService>> aop, String pattern, Codelet initCode) {
        this.name = name;
        this.intf = intf;
        this.impl = impl;
        this.paramTypes = paramTypes;
        this.params = params;
        this.mode = mode;
        this.aop = aop;
        this.pattern = pattern;
        this.initCode =initCode;
    }

    public String toString() {
        return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
    }

    /** @return */
    public String getPattern() {
        return this.pattern;
    }
}
